﻿<?php
	require_once('includes/fonctions.php');

	if(isset($_POST['login'])){	//Si formulaire rempli
		bdd_on();
		// __Ne jamais faire confiance à l'utilisateur, vérification en PHP de la bonne saisie des infos du formulaire
		if(($_POST['login']=='') || ($_POST['password']=='') || ($_POST['password_confirm']=='') || ($_POST['mail']=='') || ($_POST['nom_geek']=='')){
			if(VerifierAdresseMail($_POST['mail']))
				$ok="ok";
				else $ok=false;
		}
			else $ok=false;
		if($ok=="ok"){
			if(inscription($_POST['login'], $_POST['password'], $_POST['mail']))
				creer_geek($_POST['nom_geek'], $_POST['login']);
		}
	}
?>

<?php
	@session_start();
	require_once('includes/fonctions-concept.php');
?>

<?php
	doctype();
	head();

	html();
	body();
?>
		<div class='box'>
			<div class='header'>
				<?php include_once('header.php'); ?>
			</div>
			<div class="menu">
					<?php include_once('menu_haut.php'); ?>
			</div>
			<div class="content">
				<div class="menu_gauche">
					<?php include_once('menu_gauche.php'); ?>
				</div>

				<div class="content" id="texte">
					<p>
						<center>
						<form action="inscription.php" id="inscription" method="post" onsubmit="return validForm();">
							<table width="390">
								<tr>
									<td>Login : </td>
									<td><input type="text" name="login" class="input-text" /></td>
								</tr>
								<tr>
									<td>Mot de passe : </td>
									<td><input type="password" id="password" name="password" class="input-text" /></td>
								</tr>
								<tr>
									<td>Confirmation du mot de passe : </td>
									<td><input type="password" id="password2" name="password_confirm" class="input-text" /></td>
								</tr>
								<tr>
									<td>Email : </td>
									<td><input type="text" id="mail" name="mail" class="input-text" /></td>
								</tr>
								<tr>
									<td>Nom de votre G€€K : </td>
									<td><input type="text" id="nom_geek" name="nom_geek" class="input-text" /></td>
								</tr>
							</table>
							<br />
							<input type="submit" value="Inscription" class="input-button" />
						</form>
						</center>
					</p>
				</div>

			</div>
			<div class="footer">
				<?php include_once('footer.php'); ?>
			</div>
		</div>
<?php
	fbody();
fhtml();
?>